package com.fr.web.face;

import com.fr.base.CodeUtils;
import com.fr.base.FRContext;
import com.fr.base.file.ConfigManager;
import com.fr.base.xml.XMLPrintWriter;
import com.fr.base.xml.XMLableReader;
import com.fr.privilege.authentication.Authentication;
import javax.servlet.http.HttpServletRequest;

public class SchedulerNodeDef extends AbstractNodeDef
{
  private String taskName = null;
  private String actionName = null;

  public String getActionName()
  {
    return this.actionName;
  }

  public void setActionName(String paramString)
  {
    this.actionName = paramString;
  }

  public String getTaskName()
  {
    return this.taskName;
  }

  public void setTaskName(String paramString)
  {
    this.taskName = paramString;
  }

  public Access createURI(HttpServletRequest paramHttpServletRequest, Authentication paramAuthentication)
  {
    StringBuffer localStringBuffer = new StringBuffer();
    localStringBuffer.append(FRContext.getConfigManager().getServletMapping()).append("?");
    localStringBuffer.append("reportlet=schedule&task=").append(CodeUtils.cjkEncode(getTaskName())).append("&action=").append(CodeUtils.cjkEncode(getActionName()));
    return new Access(localStringBuffer.toString(), true);
  }

  public void readXML(XMLableReader paramXMLableReader)
  {
    super.readXML(paramXMLableReader);
    if ((paramXMLableReader.isChildNode()) && ("ScheduleAttributes".equals(paramXMLableReader.getTagName())))
    {
      String str;
      if ((str = paramXMLableReader.getAttr("taskName")) != null)
        setTaskName(str);
      if ((str = paramXMLableReader.getAttr("actionName")) != null)
        setActionName(str);
    }
  }

  public void writeXML(XMLPrintWriter paramXMLPrintWriter)
  {
    super.writeXML(paramXMLPrintWriter);
    paramXMLPrintWriter.startTAG("ScheduleAttributes");
    if (getTaskName() != null)
      paramXMLPrintWriter.attr("taskName", getTaskName());
    if (getActionName() != null)
      paramXMLPrintWriter.attr("actionName", getActionName());
    paramXMLPrintWriter.end();
  }

  public Object clone()
    throws CloneNotSupportedException
  {
    return ((SchedulerNodeDef)super.clone());
  }
}